package demo5;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
public class Person {
    @Resource//111会跟Autowired一样报装配冲突异常
    private Clothes clothes;

    @Override
    public String toString() {
        return "Person{" +
                "clothes=" + clothes +
                '}';
    }
    //@Resource(name="shirt")//222可以根据name参数指定的类名去装配Spring管理的一个类，类名首字母小写，否则noSuchBean异常
    //@Resource(name="sweater")
    //private Clothes clothes;
    // @Override
    //    public String toString() {
    //        return "Person{" +
    //                "clothes=" + clothes +
    //                '}';
    //    }

// 33333
//    @Resource
//    private Clothes shirt;
//    @Override
//    public String toString() {
//        return "Person{" +
//                "clothes=" + shirt +
//                '}';
//    }
}
